//跳转方法
function hrefgo(e){
    var url= e.dataset.href;
    var pageid=e.dataset.page;
    var euserid=e.dataset.euser;
    var eid=url.match(/[0-9]+/)[0];
    $.cookie("pulupagescroll",$(window).scrollTop());//当前滚动距离
    $.cookie("pulupagepage",pageid);//当前显示页面
    $.cookie("tjcurrentIndex",tjcurrentIndex);//推荐数据页码
    $.cookie("zhncurrentIndex",zhncurrentIndex);//召唤你数据页码
    $.cookie("jycurrentIndex",jycurrentIndex);//经验 铺路数据页码
    $.cookie("quecurrentIndex",quecurrentIndex);//问题 铺路数据页码
    if(euserid==id){
        $.cookie("paynum",eid);
        location.href=url;
    }else{
        if(e.dataset.money&& parseFloat(e.dataset.money)>0){
            console.log("有金钱的经验");
			//判断能不能去看详情页   
			$.ajax({
                type:"post",
                datatype:"json",
                url:textexpurl,
                data:{"quserId":euserid,"contentId":eid,"userId":id,"score":parseFloat(e.dataset.money)},
                success:function(d){
                    console.log(d);
                    if(d.Message=="自己的经验"||d.Message=="已付费"||d.Message=="未付费"){
                        $.cookie("paynum",eid);
                        location.href=url;
                    }else{
                        $.cookie("paynum","NO");
                        $(".modal_bg").css("display","block");
                        $(".sharepaymob").css("display","block");
                    }
                }
            });
            //付款
            
            
        }else{
            if(e.dataset.qid){
                $.cookie("paynum","NO");
                $.cookie("myid",id);
                $.cookie("myqid",e.dataset.qid);
                location.href="questiondetail.html";
            }else{
                $.cookie("paynum","NO");
                location.href=url;
            }
        }
    }
}

	//铺路推荐
											var tjcurrentIndex=1;
											var jycurrentIndex=1;
											var zhncurrentIndex=1;
											var quecurrentIndex=1;

											var tjover=0;//推荐接口数据状态 0有数据 1没数据
											var jyover=0;//经验接口数据状态
											var zhnover=0;//召唤你接口数据状态
											var queover=0;//召唤你接口数据状态
											var pageSize=7;//一页显示几条新闻
											//var newsnum=0;//第几条新闻
											var readyover=0;//控制页面滚动0正常 1加载中



										    //时间 几天前 几分钟前
											function getDateTimeStamp(dateStr){
												  dateStr=dateStr.match(/[0-9\-T\:]+/)[0].replace(/T/g,' ');
												return Date.parse(dateStr.replace(/-/gi,"/"));
											}
												function getDateDiff(dateTimeStamp){
													var minute = 1000 * 60;
													var hour = minute * 60;
													var day = hour * 24;
													var halfamonth = day * 15;
													var month = day * 30;
													var now = new Date().getTime();
													var diffValue = now - dateTimeStamp;
													if(diffValue < 0){return;}
													var monthC =diffValue/month;
													var weekC =diffValue/(7*day);
													var dayC =diffValue/day;
													var hourC =diffValue/hour;
													var minC =diffValue/minute;
													if(monthC>=1){
														result="" + parseInt(monthC) + "月前";
													}
													else if(weekC>=1){
														result="" + parseInt(weekC) + "周前";
													}
													else if(dayC>=1){
														result=""+ parseInt(dayC) +"天前";
													}
													else if(hourC>=1){
														result=""+ parseInt(hourC) +"小时前";
													}
													else if(minC>=1){
														result=""+ parseInt(minC) +"分钟前";
													}else
														result="刚刚";
													return result;
												}



document.onkeydown=function(event){
    var e = event || window.event || arguments.callee.caller.arguments[0];
    if(e && e.keyCode==13){ // enter 键
        var word=document.getElementById("searchinput").value;
        if(word){
            if(word.match(/^\s+$/g)){
                console.log("没有填信息")
            }else{
                location.href="search.html?searchKey="+word;
            }
        }
    }
};

//召唤你页面  //按钮
											var tuijian=document.getElementById("tuijian"); //推荐
											var expbtn=document.getElementById("expbtn");  //经验
											var askyou=document.getElementById("askyou");   //召唤你
											var quebtn=document.getElementById("quebtn"); //问题

											var tuijianlist=document.getElementById("tuijianlist");//推荐页面
											var explist=document.getElementById("explist");//经验
											var askyoulist=document.getElementById("askyoulist");//召唤你
											var quelist=document.getElementById("quelist"); //问题
											var loca=location.href;

											if(loca.match("pageistj")){
												explist.style.display="none";
												askyoulist.style.display="none";
												tuijianlist.style.display="block";
												quelist.style.display="none";
												quebtn.parentNode.className="HeaderSwitcherItem";
												askyou.parentNode.className="HeaderSwitcherItem";
												expbtn.parentNode.className="HeaderSwitcherItem";
												tuijian.parentNode.className="HeaderSwitcherItem is_active";
											}else if(loca.match("pageisjy")){
												askyoulist.style.display="none";
												tuijianlist.style.display="none";
												explist.style.display="block";
												quelist.style.display="none";
												quebtn.parentNode.className="HeaderSwitcherItem";
												askyou.parentNode.className="HeaderSwitcherItem";
												tuijian.parentNode.className="HeaderSwitcherItem";
												expbtn.parentNode.className="HeaderSwitcherItem is_active";
											}else if(loca.match("pageisque")){
												explist.style.display="none";
												askyoulist.style.display="none";
												tuijianlist.style.display="none";
												quelist.style.display="block";
												quebtn.parentNode.className="HeaderSwitcherItem is_active";
												askyou.parentNode.className="HeaderSwitcherItem";
												expbtn.parentNode.className="HeaderSwitcherItem";
												tuijian.parentNode.className="HeaderSwitcherItem";
											}else if(loca.match("pageiszhn")){
												askyoulist.style.display="block";
												explist.style.display="none";
												tuijianlist.style.display="none";
												quelist.style.display="none";
												quebtn.parentNode.className="HeaderSwitcherItem";
												tuijian.parentNode.className="HeaderSwitcherItem";
												askyou.parentNode.className="HeaderSwitcherItem is_active";
												expbtn.parentNode.className="HeaderSwitcherItem";
											}
											askyou.onclick=function(){
												askyoulist.style.display="block";
												explist.style.display="none";
												tuijianlist.style.display="none";
												quelist.style.display="none";
												quebtn.parentNode.className="HeaderSwitcherItem";
												tuijian.parentNode.className="HeaderSwitcherItem";
												askyou.parentNode.className="HeaderSwitcherItem is_active";
												expbtn.parentNode.className="HeaderSwitcherItem";
											};
											expbtn.onclick=function(){
												askyoulist.style.display="none";
												tuijianlist.style.display="none";
												explist.style.display="block";
												quelist.style.display="none";
												quebtn.parentNode.className="HeaderSwitcherItem";
												askyou.parentNode.className="HeaderSwitcherItem";
												tuijian.parentNode.className="HeaderSwitcherItem";
												expbtn.parentNode.className="HeaderSwitcherItem is_active";
											};
											tuijian.onclick=function(){
												explist.style.display="none";
												askyoulist.style.display="none";
												tuijianlist.style.display="block";
												quelist.style.display="none";
												quebtn.parentNode.className="HeaderSwitcherItem";
												askyou.parentNode.className="HeaderSwitcherItem";
												expbtn.parentNode.className="HeaderSwitcherItem";
												tuijian.parentNode.className="HeaderSwitcherItem is_active";
											};
											quebtn.onclick=function(){
												explist.style.display="none";
												askyoulist.style.display="none";
												tuijianlist.style.display="none";
												quelist.style.display="block";
												quebtn.parentNode.className="HeaderSwitcherItem is_active";
												askyou.parentNode.className="HeaderSwitcherItem";
												expbtn.parentNode.className="HeaderSwitcherItem";
												tuijian.parentNode.className="HeaderSwitcherItem";
											};
									
											//快捷按钮
											document.getElementsByClassName("quickexp")[0].onclick=function(){
												//location.href="sendquestion.html?qtype=3";
												location.href="sendexp.html";
											};
											document.getElementsByClassName("quickquestion")[0].onclick=function(){
												//location.href="sendquestion.html?qtype=2";
												location.href="sendquestion.html";
											};
																						var quick=document.getElementsByClassName("quick")[0];
											var quicklist=document.getElementsByClassName("quicklist")[0];
											quick.onclick=function(){
												if(quicklist.style.display==="block"){
													quicklist.style.display="none";
												}else if(quicklist.style.display==="none"){
													quicklist.style.display="block";
												}
											};
											//付费分享
											var sharepay=document.getElementsByClassName("sharepay");
											var sharepaymob=document.getElementsByClassName("sharepaymob")[0];
											var cancel3=document.getElementsByClassName("cancel3")[0];
											var sharepayword=document.getElementsByClassName("sharepayword")[0];
											var askpayword=document.getElementsByClassName("askpayword")[0];
											var modalbg=document.getElementsByClassName("modal_bg2")[0];
											for(var sh=0;sh<sharepay.length;sh++){
												sharepay[sh].onclick=function(){
													modalbg.style.display="block";
													sharepaymob.style.display="block";
													sharepayword.style.display="block";
													askpayword.style.display="none";
												}
											}
											cancel3.onclick=function(){
												if(modalbg.style.display=="block"&&sharepaymob.style.display=="block"){
													modalbg.className+=' animate_out';
													sharepaymob.className+=' animate_out';
												}
												timer=setTimeout(changeclass3,100);
											};
											//付费充值跳转
											okgobtn.onclick=function(){
												modalbg.className+=' animate_out';
												sharepaymob.className+=' animate_out';
												location.href="scoredetial.html";
											};
											function changeclass3(){
												modalbg.className='modal_bg modal_bg';
												sharepaymob.className='action_menu_container sharepaymob';
												clearTimeout();
												timer2=null;
												changedisplay3();
											};
											function changedisplay3(){
												modalbg.style.display="none";
												sharepaymob.style.display="none";
											};
											//付费回答
											var askpay=document.getElementsByClassName("askpay");
											for(var as=0;as<askpay.length;as++){
												askpay[as].onclick=function(){
													modalbg.style.display="block";
													sharepaymob.style.display="block";
													sharepayword.style.display="none";
													askpayword.style.display="block";
												}
											}
											cancel3.onclick=function(){
												if(modalbg.style.display=="block"&&sharepaymob.style.display=="block"){
													modalbg.className+=' animate_out';
													sharepaymob.className+=' animate_out';
												}
												timer=setTimeout(changeclass3,100);
											};


											

var id;
if($.cookie("MYID")){id=$.cookie("MYID")};
var returnurl=encodeURIComponent("http://www.tiantianqiche.cn/questionlist.html"); //同意后跳转页面
        $(document).ready(function(){
			if($.cookie("wxopenid")){
//=================================================================================================================================================================
//-----------------------------------------------------------------------------------------------------------------------------------------------------------------
//=================================================================================================================================================================
											
											
											//、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、
											
											$().ready(function(){
												if($.cookie("pulupagepage")){
													$("#tuijianlist div.addlistplace div").remove();
													$("#explist div.addlistplace div").remove();
													$("#askyoulist div.addlistplace div").remove();
													$("#quelist div.addlistplace div").remove();
													console.log("页面ID："+$.cookie("pulupagepage"));
													console.log("页面滚动距离："+$.cookie("pulupagescroll"));
													//console.log("推荐加载页码："+$.cookie("tjcurrentIndex"));
													//console.log("经验加载页码："+$.cookie("jycurrentIndex"));
													//console.log("召唤你加载页码："+$.cookie("zhncurrentIndex"));
													var pagelist=document.getElementsByClassName("HomeMainFeed");
													var navlist=document.getElementsByClassName("HeaderSwitcherItem");
													for(var r= 0,le=pagelist.length;r<le;r++){
														if($.cookie("pulupagepage").match(pagelist[r].id)){
															pagelist[r].style.display="block";
															navlist[r].className="HeaderSwitcherItem is_active";
														}else{
															pagelist[r].style.display="none";
															navlist[r].className="HeaderSwitcherItem";
														}
													}
													readyover=1;//控制页面滚动
													//推荐
													tjpageSize=parseFloat($.cookie("tjcurrentIndex"))*7;
													tj(1,tjpageSize);
													tjcurrentIndex=parseFloat($.cookie("tjcurrentIndex"));
													//经验
													jypageSize=parseFloat($.cookie("jycurrentIndex"))*7;
													jy(1,jypageSize);
													jycurrentIndex=parseFloat($.cookie("jycurrentIndex"));
													//召唤你
													zhnpageSize=parseFloat($.cookie("zhncurrentIndex"))*7;
													zhn(1,zhnpageSize);
													zhncurrentIndex=parseFloat($.cookie("zhncurrentIndex"));
													//问题
													quepageSize=parseFloat($.cookie("quecurrentIndex"))*7;
													que(1,quepageSize);
													quecurrentIndex=parseFloat($.cookie("quecurrentIndex"));
												}
												else{
													if(id){
														tj(tjcurrentIndex,pageSize);
														zhn(zhncurrentIndex,pageSize);
														jy(jycurrentIndex,pageSize);
														que(quecurrentIndex,pageSize)
													}
												}
											});
											$(window).scroll(function(){
												var mainheight=$(".home_feed").height();
												var windowheight=$(window).height();
												var what=$(".home_feed").offset().top;
												var chajuli=$(".home_feed").offset().top - $(window).scrollTop();
												var cz=windowheight-mainheight+50;
												if(chajuli<cz&&readyover===0){
													//console.log("tjover:"+tjover);
													//console.log("jyover:"+jyover);
													//console.log("queover:"+queover);
													//console.log("zhnover:"+zhnover);
													//判断哪个页面滑动
													//tuijianlist
													if(document.getElementById("tuijianlist").style.display=="block"&&tjover==0){
														console.log("推荐页面滚动");
														tjcurrentIndex++;
														readyover=1;
														tj(tjcurrentIndex,pageSize);
													}else if(document.getElementById("explist").style.display=="block"&&jyover==0){
														console.log("经验页面滚动");
														jycurrentIndex++;
														readyover=1;
														jy(jycurrentIndex,pageSize);
													}else if(document.getElementById("quelist").style.display=="block"&&queover==0){
														console.log("问题页面滚动");
														quecurrentIndex++;
														readyover=1;
														que(quecurrentIndex,pageSize);
													}else if(document.getElementById("askyoulist").style.display=="block"&&zhnover==0){
														console.log("召唤你页面滚动");
														zhncurrentIndex++;
														readyover=1;
														zhn(zhncurrentIndex,pageSize);
													}
												}
											});
									
											//拿推荐数据
											function tj(tjcurrentIndex,pageSize){
												if(tjover===0){
													console.log("tjover:"+tjover);
													$.ajax({
														type:"get",
														datatype:"json",
														url:tuijianurl+id+"&currentIndex="+tjcurrentIndex+"&pageSize="+pageSize,
														success:function(d){
															console.log("推荐");
															console.log(d);
															if(d.Message=="没有数据"){
																tjover=1;
																console.log("tjover没有数据了readyover："+readyover);
																$("#waiting").remove();
																$("#nonews").css("display","block");
															}else if(d.Data&&d.Data.length>0&&d.Data.length<pageSize){
																$("#waiting").remove();
																$("#nonews").css("display","block");
															}
															var ulid="#tuijianlist";
															datafun(d,ulid,tjover);//页面样式一样 通用方法
														}
													})
												}
											}
											//拿问题数据
											function que(quecurrentIndex,pageSize){
												if(queover===0){
													$.ajax({
														type:"get",
														datatype:"json",
														url:expurl+id+"&qtype=2&currentIndex="+quecurrentIndex+"&pageSize="+pageSize,
														success:function(d){
															console.log("问题");
															console.log(d);
															if(d.Message=="没有数据"){
																queover=1;
																console.log("queover没有数据了readyover："+readyover);
																$("#waiting2").remove();
																$("#nonews2").css("display","block");
															}else if(d.Data&&d.Data.length>0&&d.Data.length<pageSize){
																$("#waiting2").remove();
																$("#nonews2").css("display","block");
															}
															var ulid="#quelist";
															datafun(d,ulid,queover);//页面样式一样 通用方法
														}
													})
												}
											}
											//召唤你数据
											function zhn(zhncurrentIndex,pageSize){
												if(zhnover===0){
													$.ajax({
														type:"get",
														datatype:"json",
														url:callyouurl+id+"&currentIndex="+zhncurrentIndex+"&pageSize="+pageSize,
														success:function(d){
															console.log("召唤你");
															console.log(d);
															if(d.Message=="没有数据"){
																zhnover=1;
																console.log("zhnover没有数据了readyover："+readyover);
																$("#waiting3").remove();
																$("#nonews3").css("display","block");
															}else if(d.Data&&d.Data.length>0&&d.Data.length<pageSize){
																$("#waiting3").remove();
																$("#nonews3").css("display","block");
															}
															var ulid="#askyoulist";
															datafun(d,ulid,zhnover);//页面样式一样 通用方法
														}
													})
												}
											}
//通用方法，样式差不多的 推荐
function datafun(d,ulid,num){
    //console.log(ulid);
    //console.log($.cookie("pulupagepage"));
    var fortime=0;//记录循环次数
    if(d.Message=="没有数据"){
        num=1;
        readyover=0;
        console.log("没有数据了readyover："+readyover);
    }else{
        for(var i= 0,r=d.Data.length;i<r;i++){
            fortime++;
            d.Data[i].index=i;
            if(d.Data[i].Pulu_Question.title&&d.Data[i].Pulu_Question.title.length>0){
                var unick="";
                if(d.Data[i].user){
                    if(d.Data[i].user.nick){
                        if(d.Data[i].Pulu_Question.ishidename==1&&d.Data[i].user.userId!=id){
                            unick="<a>匿名</a>";
                        }else{
                            unick="<a href='otherpeoplepage.html?otherid="+d.Data[i].user.userId+"'>"+d.Data[i].user.nick+"</a>";
                        }
                    }
                }
                var money="";//有没有钱
                  if(d.Data[i].Pulu_Question.score>0){
                    money="<span class='havemy'><img src='img/money04.png'>"+d.Data[i].Pulu_Question.score+"</span>";
                }
                var tim="";
                if(d.Data[i].Pulu_Question.ctime){
                    tim=getDateDiff(getDateTimeStamp(d.Data[i].Pulu_Question.ctime));
                }
                var count=0;
                if(d.Data[i].Pulu_Question.count){
                    count=d.Data[i].Pulu_Question.count;
                }
             
                var caller="";
                if(ulid==="#askyoulist"){
                    caller="&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;召唤者："+d.Data[i].atmeuser.nick;
                    console.log(caller);
                    var des="";
                    if(d.Data[i].Pulu_Question.des){
                        des=d.Data[i].Pulu_Question.des;
                    }
                    var sharetim="";
                    if(d.Data[i].atmeTime){
                        d.Data[i].atmeTime=d.Data[i].atmeTime.match(/[0-9\-T\:]+/)[0];
                        sharetim=getDateDiff(getDateTimeStamp(d.Data[i].atmeTime));
						console.log(d.Data[i].atmeTime);
						console.log(sharetim);
                    }
                    $("#askyoulist .addlistplace").append("<div class='pagedlist_item shareexperience'><div class='feed_item feed_type_question'><div class='EventHeader'><span class='senduser'>"+ d.Data[i].atmeuser.nick+"</span>·"+sharetim+"</div><div class='info_wrapper' style='margin-left:10px;margin-top:7px;'> <div class='info'> <span class='feed_item_answer_user'>"+des+"</span> </div> </div> <div class='borderbox'><div class='EventHeader'><span class='senduser'>"+unick+"</span>·"+tim+money+"</div><h2><a class='question_link' onclick='hrefgo(this)' data-money='"+d.Data[i].Pulu_Question.score+"' data-page='"+ulid+"' data-href='shareexppage.html?eid="+d.Data[i].Pulu_Question.id+"'>"+d.Data[i].Pulu_Question.title+"</a></h2><div class='ActionBar Question'> <div class='action_bar_inner'><div class='action_item'> <a class='ReadMoreActionItem'>浏览 "+count+"</a> </div> <div class='action_item'> <a class='ReadMoreActionItem'></a> </div></div></div></div></div></div>")
                }else{
                    if(d.Data[i].Pulu_Question.qtype===2||(!d.Data[i].Pulu_Question.qtype)){//问题 或无类型
                        if(ulid==="#quelist"){
                            if(d.Data[i].Pulu_Question.isShared===0){
                                $(ulid+" .addlistplace").append("<div class='pagedlist_item'><div class='feed_item feed_type_question'><div class='EventHeader'><span class='senduser'>"+unick+"</span>·"+tim+money+"</div><h2><a class='question_link' onclick='hrefgo(this)' data-page='"+ulid+"' data-href='questiondetail.html?qid="+d.Data[i].Pulu_Question.id+"'>"+d.Data[i].Pulu_Question.title+"</a></h2><div class='ContentFooter QuestionFooter'>浏览 "+count+"&nbsp;&nbsp;&nbsp;"+caller+"</div><div class='ActionBar Question'> <div class='action_bar_inner'><div class='primary_item'> <a class='WriteAnswer Button' onclick='hrefgo(this)' data-page='"+ulid+"' data-href='answerpage.html?qid="+d.Data[i].Pulu_Question.id+"'>回答 </a> </div> </div></div></div></div>")
                            }else if(d.Data[i].Pulu_Question.isShared===1){
                                var des="";
                                if(d.Data[i].Pulu_Question.des){
                                    des=d.Data[i].Pulu_Question.des;
                                }
                                var sharetim="";
                                console.log(d.Data[i].atmeTime);
                                if(d.Data[i].Pulu_Question.shareTime){
                                    //d.Data[i].atmeTime=d.Data[i].atmeTime.match(/[0-9\-T\:]+/)[0];
                                    sharetim=getDateDiff(getDateTimeStamp(d.Data[i].Pulu_Question.shareTime));
                                }
                                $("#quelist .addlistplace").append("<div class='pagedlist_item'><div class='feed_item feed_type_question'><div class='EventHeader'><span class='senduser'>"+ d.Data[i].shareUser.nick+"</span>·"+sharetim+"</div><div class='info_wrapper' style='margin-left:10px;margin-top:7px;'> <div class='info'> <span class='feed_item_answer_user'>"+des+"</span> </div> </div> <div class='borderbox'><div class='EventHeader'><span class='senduser'>"+unick+"</span>·"+tim+money+"</div><h2><a class='question_link' onclick='hrefgo(this)' data-page='"+ulid+"' data-href='questiondetail.html?qid="+d.Data[i].Pulu_Question.id+"'>"+d.Data[i].Pulu_Question.title+"</a></h2><div class='ActionBar Question'> <div class='action_bar_inner'><div class='action_item'> <a class='ReadMoreActionItem'>浏览 "+count+"</a> </div> <div class='action_item'> <a class='ReadMoreActionItem'></a> </div></div></div></div></div></div>")
                            }
                        }else{
                            //<div class='primary_item'> <span class='CantAnswerLink action_button'>跳过</span> </div>
                            $(ulid+" .addlistplace").append("<div class='pagedlist_item'><div class='feed_item feed_type_question'><div class='EventHeader'><span class='senduser'>"+unick+"</span>·"+tim+money+"</div><h2><a class='question_link' onclick='hrefgo(this)' data-page='"+ulid+"' data-href='questiondetail.html?qid="+d.Data[i].Pulu_Question.id+"'>"+d.Data[i].Pulu_Question.title+"</a></h2><div class='ContentFooter QuestionFooter'>浏览 "+count+"&nbsp;&nbsp;&nbsp;"+caller+"</div><div class='ActionBar Question'> <div class='action_bar_inner'><div class='primary_item'> <a class='WriteAnswer Button' onclick='hrefgo(this)' data-page='"+ulid+"' data-href='answerpage.html?qid="+d.Data[i].Pulu_Question.id+"'>回答 </a> </div> </div></div></div></div>")
                        }
                    }
                    else if(d.Data[i].Pulu_Question.qtype===3){
                        //判断是否有点赞者
                        var userimg="";//保存头像代码段
                        if(d.Data[i].userList.length>0&&d.Data[i].userList.length<10){
                            for(var r1=0;r1<d.Data[i].userList.length;r1++){
                                if(d.Data[i].userList[r1]){
                                    //console.log(d.Data[i].userList[r1].nick);
                                    if(d.Data[i].userList[r1].userAva){
                                        userimg+="<div><img src='http://42.62.66.198:8003/"+d.Data[i].userList[r1].userAva+"'/></div>";
                                    }
                                }
                            }
                        }else if(d.Data[i].userList.length>0&&d.Data[i].userList.length>10){
                            for(var r2=0;r2<10;r2++){
                                if(d.Data[i].userList[r2]){
                                    console.log(d.Data[i].userList[r2].nick);
                                    if(d.Data[i].userList[r2].userAva){
                                        userimg+="<div><img src='http://42.62.66.198:8003/"+d.Data[i].userList[r2].userAva+"'/></div>";
                                    }
                                }
                            }
                        }
                        //<div class='primary_item'> <span class='CantAnswerLink action_button'>跳过</span> </div>
                        $(ulid+" .addlistplace").append("<div class='pagedlist_item shareexperience'><div class='feed_item feed_type_question'><div class='EventHeader'><span class='senduser'>"+unick+"</span>·"+tim+money+"</div><h2><a class='question_link' data-money='"+d.Data[i].Pulu_Question.score+"' onclick='hrefgo(this)' data-page='"+ulid+"' data-euser='"+d.Data[i].Pulu_Question.questionUserId+"' data-href='shareexppage.html?eid="+d.Data[i].Pulu_Question.id+"'>"+d.Data[i].Pulu_Question.title+"</a></h2><div class='upviter'>"+userimg+"</div><div class='ActionBar Question'> <div class='action_bar_inner'><div class='action_item'> <a class='ReadMoreActionItem'>浏览 "+count+"</a> </div> <div class='action_item'> <a class='ReadMoreActionItem'>有用 "+d.Data[i].UpCount+caller+"</a> </div></div></div></div></div>")
                    }
                }

            };
            //页面滚动判断
            if(ulid===$.cookie("pulupagepage")&&fortime===r){
                $(window).scrollTop(parseFloat($.cookie("pulupagescroll")));
                $.cookie("pulupagepage","");//清除页面ID
                $.cookie("pulupagescroll","");//当前滚动距离
                $.cookie("pulupagepage","");//当前显示页面
                $.cookie("tjcurrentIndex","");//推荐数据页码
                $.cookie("zhncurrentIndex","");//召唤你数据页码
                $.cookie("jycurrentIndex","");//经验 铺路数据页码
                $.cookie("quecurrentIndex","");//问题 铺路数据页码
            }
            if(fortime===r){
                readyover=0;
            }
        };
        num=0;
    }
};

											//经验数据
function jy(jycurrentIndex,pageSize){
    if(jyover===0){
        //console.log("经验");
        $.ajax({
            type:"get",
            datatype:"json",
            url:expurl+id+"&qtype=3&currentIndex="+jycurrentIndex+"&pageSize="+pageSize,
            success:function(d){
                console.log("经验数据");
                console.log(d);
                var ulid="#explist";
                if(d.Message==="没有数据"||(d.Data&&d.Data.length===0)){
                    jyover=1;
                    readyover=0;
                    console.log("jyover没有数据了readyover："+readyover);
                    $("#waiting1").remove();
                    $("#nonews1").css("display","block");
                }else{
                    if(d.Data.length<pageSize){
                        $("#waiting1").remove();
                        $("#nonews1").css("display","block");
                    }
                    var fortime=0;//循环次数
                    for(var i= 0,r=d.Data.length;i<r ;i++){
                        fortime++;
                        d.Data[i].index=i;
                        if(d.Data[i].Pulu_Question.title&&d.Data[i].Pulu_Question.title.length>0){
                            var unick="";
                            if(d.Data[i].user){
								if(d.Data[i].user.nick){
									if(d.Data[i].Pulu_Question.ishidename==1&&d.Data[i].user.userId!=id){
										unick="<a>匿名</a>";
									}else{
										unick="<a href='otherpeoplepage.html?otherid="+d.Data[i].user.userId+"'>"+d.Data[i].user.nick+"</a>";
									}
								}
							}
                            var otherid=d.Data[i].user.userId;
                            var tim="";
                            if(d.Data[i].Pulu_Question.ctime){
                                tim=getDateDiff(getDateTimeStamp(d.Data[i].Pulu_Question.ctime));
                            }
                            var testtime=getDateTimeStamp(d.Data[i].Pulu_Question.ctime);
                            console.log(testtime);
                            var money="";//有没有钱
                            if(d.Data[i].Pulu_Question.score>0){
                                money="<span class='havemy'><img src='img/money04.png'>"+d.Data[i].Pulu_Question.score+"</span>";
                            }
                            if((d.Data[i].Pulu_Question.qtype===2||(!d.Data[i].Pulu_Question.qtype))){//问题 或无类型
                                //<div class='primary_item'> <span class='CantAnswerLink action_button'>跳过</span> </div>
                                if(d.Data[i].Pulu_Question.isShared===0){
                                    var ulid="#explist";
                                    var count=0;
                                    if(d.Data[i].Pulu_Question.count){
                                        count=d.Data[i].Pulu_Question.count;
                                    }
                                    $("#explist .addlistplace").append("<div class='pagedlist_item'><div class='feed_item feed_type_question'><div class='EventHeader'><span class='senduser'>"+unick+"</span>·"+tim+money+"</div><h2><a class='question_link' onclick='hrefgo(this)' data-qid='"+d.Data[i].Pulu_Question.id+"' data-page='"+ulid+"' data-href='questiondetail.html?qid="+d.Data[i].Pulu_Question.id+"'>"+d.Data[i].Pulu_Question.title+"</a></h2><div class='ContentFooter QuestionFooter'>浏览 "+count+"&nbsp;&nbsp;&nbsp;"+"</div><div class='ActionBar Question'> <div class='action_bar_inner'><div class='primary_item'> <a class='WriteAnswer Button' onclick='hrefgo(this)' data-page='#explist' data-href='answerpage.html?qid="+d.Data[i].Pulu_Question.id+"'>回答 </a> </div> </div></div></div></div>")
                                }else if(d.Data[i].Pulu_Question.isShared===1){
                                    var ulid="#explist";
                                    var des="";
                                    if(d.Data[i].Pulu_Question.des){
                                        des=d.Data[i].Pulu_Question.des;
                                    }
                                    var count=0;
                                    if(d.Data[i].Pulu_Question.count){
                                        count=d.Data[i].Pulu_Question.count;
                                    }
                                    var sharetim="";
                                    console.log(d.Data[i].atmeTime);
                                    if(d.Data[i].Pulu_Question.shareTime){
                                        //d.Data[i].atmeTime=d.Data[i].atmeTime.match(/[0-9\-T\:]+/)[0];
                                        sharetim=getDateDiff(getDateTimeStamp(d.Data[i].Pulu_Question.shareTime));
                                    }
                                    $("#explist .addlistplace").append("<div class='pagedlist_item'><div class='feed_item feed_type_question'><div class='EventHeader'><span class='senduser'>"+unick+"</span>·"+sharetim+money+"</div><div class='borderbox'><div class='AnswerHeader ContentHeader'> <div class='photo_info_layout size_small'> <div class='photo_wrapper'> <div class='photo'> <a onclick='hrefgo(this)' data-page='"+ulid+"'  data-href='otherpeoplepage.html?otherid="+otherid+"'><img class='profile_photo_img' src='http://42.62.66.198:8003/"+d.Data[i].user.userAva+"'> </a> </div> </div> <div class='info_wrapper'> <div class='info'> <span class='feed_item_answer_user'>"+des+"</span> </div> </div> </div> </div><h2><a class='question_link' onclick='hrefgo(this)' data-qid='"+d.Data[i].Pulu_Question.id+"' data-page='"+ulid+"' data-href='questiondetail.html?qid="+d.Data[i].Pulu_Question.id+"'>"+d.Data[i].Pulu_Question.title+"</a></h2><div class='ContentFooter QuestionFooter'>浏览 "+count+"&nbsp;&nbsp;&nbsp;"+"</div></div><div class='ActionBar Question'> <div class='action_bar_inner'><div class='primary_item'> <a class='WriteAnswer Button' onclick='hrefgo(this)' data-page='#explist' data-href='answerpage.html?qid="+d.Data[i].Pulu_Question.id+"'>回答 </a> </div> </div></div></div></div>")
                                }
                            }
                            else if(d.Data[i].Pulu_Question.qtype===3){
                                //判断是否有点赞者
                                var userimg="";//保存头像代码段
                                if(d.Data[i].userList.length>0&&d.Data[i].userList.length<10){
                                    for(var r1=0;r1<d.Data[i].userList.length;r1++){
                                        if(d.Data[i].userList[r1]){
                                            //console.log(d.Data[i].userList[r1].nick);
                                            if(d.Data[i].userList[r1].userAva){
                                                userimg+="<div><img src='http://42.62.66.198:8003/"+d.Data[i].userList[r1].userAva+"'/></div>";
                                            }
                                        }
                                    }
                                }else if(d.Data[i].userList.length>0&&d.Data[i].userList.length>10){
                                    for(var r2=0;r2<10;r2++){
                                        if(d.Data[i].userList[r2]){
                                            //console.log(d.Data[i].userList[r2].nick);
                                            if(d.Data[i].userList[r2].userAva){
                                                userimg+="<div><img src='http://42.62.66.198:8003/"+d.Data[i].userList[r2].userAva+"'/></div>";
                                            }
                                        }
                                    }
                                }
                                if(d.Data[i].Pulu_Question.isShared===0){
                                    var count=0;
                                    if(d.Data[i].Pulu_Question.count){
                                        count=d.Data[i].Pulu_Question.count;
                                    }
                                    //<div class='primary_item'> <span class='CantAnswerLink action_button'>跳过</span> </div>
                                    $("#explist .addlistplace").append("<div class='pagedlist_item shareexperience'><div class='feed_item feed_type_question'><div class='EventHeader'><span class='senduser'>"+unick+"</span>·"+tim+money+"</div><h2><a class='question_link' data-money='"+d.Data[i].Pulu_Question.score+"' onclick='hrefgo(this)' data-page='"+ulid+"' data-euser='"+d.Data[i].Pulu_Question.questionUserId+"' data-href='shareexppage.html?eid="+d.Data[i].Pulu_Question.id+"'>"+d.Data[i].Pulu_Question.title+"</a></h2><div class='upviter'>"+userimg+"</div><div class='ActionBar Question'> <div class='action_bar_inner'><div class='action_item'> <a class='ReadMoreActionItem'>浏览 "+count+"</a> </div> <div class='action_item'> <a class='ReadMoreActionItem'>有用 "+d.Data[i].UpCount+"</a> </div></div></div></div></div>")
                                }else if(d.Data[i].Pulu_Question.isShared===1){
                                    var des="";
                                    if(d.Data[i].Pulu_Question.des){
                                        des=d.Data[i].Pulu_Question.des;
                                    }
                                    var count=0;
                                    if(d.Data[i].Pulu_Question.count){
                                        count=d.Data[i].Pulu_Question.count;
                                    }
                                    var sharetim=getDateDiff(getDateTimeStamp(d.Data[i].Pulu_Question.shareTime.match(/[0-9\-T\:]+/)[0]));
                                    var tim=getDateDiff(getDateTimeStamp(d.Data[i].Pulu_Question.ctime.match(/[0-9\-T\:]+/)[0]));
                                    //<div class='AnswerHeader ContentHeader'> <div class='photo_info_layout size_small'> <div class='photo_wrapper'> <div class='photo'> <a onclick='hrefgo(this)' data-page='"+ulid+"' data-href='otherpeoplepage.html?otherid="+otherid+"'> <img class='profile_photo_img' src='http://42.62.66.198:8003/"+d.Data[i].user.userAva+"'> </a> </div> </div> </div> </div>
                                    $("#explist .addlistplace").append("<div class='pagedlist_item shareexperience'><div class='feed_item feed_type_question'><div class='EventHeader'><span class='senduser'>"+ d.Data[i].shareUser.nick+"</span>·"+sharetim+"</div><div class='info_wrapper' style='margin-left:10px;margin-top:7px;'> <div class='info'> <span class='feed_item_answer_user'>"+des+"</span> </div> </div> <div class='borderbox'><div class='EventHeader'><span class='senduser'>"+unick+"</span>·"+tim+money+"</div><h2><a class='question_link' onclick='hrefgo(this)' data-euser='"+d.Data[i].Pulu_Question.questionUserId+"' data-money='"+d.Data[i].Pulu_Question.score+"' data-page='"+ulid+"' data-href='shareexppage.html?eid="+d.Data[i].Pulu_Question.id+"'>"+d.Data[i].Pulu_Question.title+"</a></h2><div class='upviter'>"+userimg+"</div><div class='ActionBar Question'> <div class='action_bar_inner'><div class='action_item'> <a class='ReadMoreActionItem'>浏览 "+count+"</a> </div> <div class='action_item'> <a class='ReadMoreActionItem'>有用 "+d.Data[i].UpCount+"</a> </div></div></div></div></div></div>")
                                }
                            }
                        };
                        //页面滚动判断
                        if("#explist"===$.cookie("pulupagepage")&&fortime===r&&$.cookie("pulupagescroll")&&parseFloat($.cookie("pulupagescroll"))>0){
                            $(window).scrollTop(parseFloat($.cookie("pulupagescroll")));
                            readyover=0;
                            $.cookie("pulupagepage","");//清除页面ID
                            $.cookie("pulupagescroll","");//当前滚动距离
                            $.cookie("pulupagepage","");//当前显示页面
                            $.cookie("tjcurrentIndex","");//推荐数据页码
                            $.cookie("zhncurrentIndex","");//召唤你数据页码
                            $.cookie("jycurrentIndex","");//经验 铺路数据页码
                        };
                        if(fortime==r){
                            readyover=0;
                        }
                    };
                }
            }
        })
    };
}

										
//=================================================================================================================================================================
//-----------------------------------------------------------------------------------------------------------------------------------------------------------------
//=================================================================================================================================================================
			
			
			
			
			
			}else{
				//先微信验证获取openid 如果已经授权过了 直接页面截取openid 然后发送请求获取 用户的ID
            var reg=new RegExp("code=[a-zA-Z0-9]*");
            if(window.location.href.match(reg)){
                var code=window.location.href.match(reg);
                $.ajax({
                    type:"GET",
                    url:"GetOpenId.ashx?"+code,
                    async: false,
                    success:function(data){
                        var dat=$.parseJSON(data);
                        console.log(dat.openid);
                        $.cookie("wxod",dat.openid);
                        console.log("已经授权登陆");
                        //发请求获取用户的id
                        $.ajax({
                            type:"GET",
                            url:getwxopenidurl+dat.openid,
                            success:function(d){
                                console.log("服务器openid获取的userID："+d);
                                console.log(d.Data);
                                //如果没有用户id 则证明用户是第一次登陆 保存openid跳转至登录页面
                                if(!d.Data){
								console.log("have no data");
                                    $.cookie("wxopenid",dat.openid);
									 //alert($.cookie("wxopenid"));
                                    location.href="login.html";
                                }else if(d.Data&&d.Data.webchatId){
                                     console.log("已经存储了openid");
                                        $.cookie("wxopenid",d.Data.webchatId);
                                        console.log($.cookie("wxopenid"));
                                        $.cookie("MYID",d.Data.userId);
										id=d.Data.userId;
                                        console.log($.cookie("MYID"));
//=================================================================================================================================================================
//-----------------------------------------------------------------------------------------------------------------------------------------------------------------
//=================================================================================================================================================================
											
											$().ready(function(){
												if($.cookie("pulupagepage")){
													$("#tuijianlist div.addlistplace div").remove();
													$("#explist div.addlistplace div").remove();
													$("#askyoulist div.addlistplace div").remove();
													$("#quelist div.addlistplace div").remove();
													console.log("页面ID："+$.cookie("pulupagepage"));
													console.log("页面滚动距离："+$.cookie("pulupagescroll"));
													//console.log("推荐加载页码："+$.cookie("tjcurrentIndex"));
													//console.log("经验加载页码："+$.cookie("jycurrentIndex"));
													//console.log("召唤你加载页码："+$.cookie("zhncurrentIndex"));
													var pagelist=document.getElementsByClassName("HomeMainFeed");
													var navlist=document.getElementsByClassName("HeaderSwitcherItem");
													for(var r= 0,le=pagelist.length;r<le;r++){
														if($.cookie("pulupagepage").match(pagelist[r].id)){
															pagelist[r].style.display="block";
															navlist[r].className="HeaderSwitcherItem is_active";
														}else{
															pagelist[r].style.display="none";
															navlist[r].className="HeaderSwitcherItem";
														}
													}
													readyover=1;//控制页面滚动
													//推荐
													tjpageSize=parseFloat($.cookie("tjcurrentIndex"))*7;
													tj(1,tjpageSize);
													tjcurrentIndex=parseFloat($.cookie("tjcurrentIndex"));
													//经验
													jypageSize=parseFloat($.cookie("jycurrentIndex"))*7;
													jy(1,jypageSize);
													jycurrentIndex=parseFloat($.cookie("jycurrentIndex"));
													//召唤你
													zhnpageSize=parseFloat($.cookie("zhncurrentIndex"))*7;
													zhn(1,zhnpageSize);
													zhncurrentIndex=parseFloat($.cookie("zhncurrentIndex"));
													//问题
													quepageSize=parseFloat($.cookie("quecurrentIndex"))*7;
													que(1,quepageSize);
													quecurrentIndex=parseFloat($.cookie("quecurrentIndex"));
												}
												else{
													if(id){
														tj(tjcurrentIndex,pageSize);
														zhn(zhncurrentIndex,pageSize);
														jy(jycurrentIndex,pageSize);
														que(quecurrentIndex,pageSize)
													}
												}
											});
											$(window).scroll(function(){
												var mainheight=$(".home_feed").height();
												var windowheight=$(window).height();
												var what=$(".home_feed").offset().top;
												var chajuli=$(".home_feed").offset().top - $(window).scrollTop();
												var cz=windowheight-mainheight+50;
												if(chajuli<cz&&readyover===0){
													//console.log("tjover:"+tjover);
													//console.log("jyover:"+jyover);
													//console.log("queover:"+queover);
													//console.log("zhnover:"+zhnover);
													//判断哪个页面滑动
													//tuijianlist
													if(document.getElementById("tuijianlist").style.display=="block"&&tjover==0){
														console.log("推荐页面滚动");
														tjcurrentIndex++;
														readyover=1;
														tj(tjcurrentIndex,pageSize);
													}else if(document.getElementById("explist").style.display=="block"&&jyover==0){
														console.log("经验页面滚动");
														jycurrentIndex++;
														readyover=1;
														jy(jycurrentIndex,pageSize);
													}else if(document.getElementById("quelist").style.display=="block"&&queover==0){
														console.log("问题页面滚动");
														quecurrentIndex++;
														readyover=1;
														que(quecurrentIndex,pageSize);
													}else if(document.getElementById("askyoulist").style.display=="block"&&zhnover==0){
														console.log("召唤你页面滚动");
														zhncurrentIndex++;
														readyover=1;
														zhn(zhncurrentIndex,pageSize);
													}
												}
											});
											//$("#tuijianlist").scroll(function(){
											//    var mainheight=$(".home_feed").height();
											//    var windowheight=$(window).height();
											//    var what=$(".home_feed").offset().top;
											//    var chajuli=$(".home_feed").offset().top - $(window).scrollTop();
											//    var cz=windowheight-mainheight+50;
											//    if(chajuli<cz&&readyover===0){
											//        //判断哪个页面滑动
											//        readyover=1;
											//        var tuijianlist=document.getElementById("tuijianlist");
											//        if(tuijianlist.style.display=="block"){
											//            tjcurrentIndex++;
											//            tj(tjcurrentIndex,pageSize);
											//        }else if(explist.style.display=="block"){
											//            jycurrentIndex++;
											//            jy(jycurrentIndex,pageSize);
											//        }else if(askyoulist.style.display=="block"){
											//            zhncurrentIndex++;
											//            zhn(zhncurrentIndex,pageSize);
											//        }
											//    }
											//});
											//拿推荐数据
											function tj(tjcurrentIndex,pageSize){
												if(tjover===0){
													console.log("tjover:"+tjover);
													$.ajax({
														type:"get",
														datatype:"json",
														url:tuijianurl+id+"&currentIndex="+tjcurrentIndex+"&pageSize="+pageSize,
														success:function(d){
															console.log("推荐");
															console.log(d);
															if(d.Message=="没有数据"){
																tjover=1;
																console.log("tjover没有数据了readyover："+readyover);
																$("#waiting").remove();
																$("#nonews").css("display","block");
															}else if(d.Data.length<pageSize){
																$("#waiting").remove();
																$("#nonews").css("display","block");
															}
															var ulid="#tuijianlist";
															datafun(d,ulid,tjover);//页面样式一样 通用方法
														}
													})
												}
											}
											//拿问题数据
											function que(quecurrentIndex,pageSize){
												if(queover===0){
													$.ajax({
														type:"get",
														datatype:"json",
														url:expurl+id+"&qtype=2&currentIndex="+quecurrentIndex+"&pageSize="+pageSize,
														success:function(d){
															console.log("问题");
															console.log(d);
															if(d.Message=="没有数据"){
																queover=1;
																console.log("queover没有数据了readyover："+readyover);
																$("#waiting2").remove();
																$("#nonews2").css("display","block");
															}else if(d.Data.length<pageSize){
																$("#waiting2").remove();
																$("#nonews2").css("display","block");
															}
															var ulid="#quelist";
															datafun(d,ulid,queover);//页面样式一样 通用方法
														}
													})
												}
											}
											//召唤你数据
											function zhn(zhncurrentIndex,pageSize){
												if(zhnover===0){
													$.ajax({
														type:"get",
														datatype:"json",
														url:callyouurl+id+"&currentIndex="+zhncurrentIndex+"&pageSize="+pageSize,
														success:function(d){
															console.log("召唤你");
															console.log(d);
															if(d.Message=="没有数据"){
																zhnover=1;
																console.log("zhnover没有数据了readyover："+readyover);
																$("#waiting3").remove();
																$("#nonews3").css("display","block");
															}else if(d.Data.length<pageSize){
																$("#waiting3").remove();
																$("#nonews3").css("display","block");
															}
															var ulid="#askyoulist";
															datafun(d,ulid,zhnover);//页面样式一样 通用方法
														}
													})
												}
											}
//通用方法，样式差不多的 推荐
function datafun(d,ulid,num){
    //console.log(ulid);
    //console.log($.cookie("pulupagepage"));
    var fortime=0;//记录循环次数
    if(d.Message=="没有数据"){
        num=1;
        readyover=0;
        console.log("没有数据了readyover："+readyover);
    }else{
        for(var i= 0,r=d.Data.length;i<r;i++){
            fortime++;
            d.Data[i].index=i;
            if(d.Data[i].Pulu_Question.title.length>0){
                var unick="";
                if(d.Data[i].user){
                    if(d.Data[i].user.nick){
                        if(d.Data[i].Pulu_Question.ishidename==1&&d.Data[i].user.userId!=id){
                            unick="<a>匿名</a>";
                        }else{
                            unick="<a href='otherpeoplepage.html?otherid="+d.Data[i].user.userId+"'>"+d.Data[i].user.nick+"</a>";
                        }
                    }
                }
           
                var tim="";
                if(d.Data[i].Pulu_Question.ctime){
                    tim=getDateDiff(getDateTimeStamp(d.Data[i].Pulu_Question.ctime));
                }
                var count=0;
                if(d.Data[i].Pulu_Question.count){
                    count=d.Data[i].Pulu_Question.count;
                }
                var money="";//有没有钱
                 if(d.Data[i].Pulu_Question.score>0){
                    money="<span class='havemy'><img src='img/money04.png'>"+d.Data[i].Pulu_Question.score+"</span>";
                }
                var caller="";
                if(ulid==="#askyoulist"){
                    caller="&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;召唤者："+d.Data[i].atmeuser.nick;
                    console.log(caller);
                    var des="";
                    if(d.Data[i].Pulu_Question.des){
                        des=d.Data[i].Pulu_Question.des;
                    }
                    var sharetim=getDateDiff(d.Data[i].Pulu_Question.shareTime);
                    $("#askyoulist .addlistplace").append("<div class='pagedlist_item'><div class='feed_item feed_type_question'><div class='EventHeader'><span class='senduser'>"+ d.Data[i].atmeuser.nick+"</span>·"+sharetim+"</div><div class='info_wrapper' style='margin-left:10px;margin-top:7px;'> <div class='info'> <span class='feed_item_answer_user'>"+des+"</span> </div> </div> <div class='borderbox'><div class='EventHeader'><span class='senduser'>"+unick+"</span>·"+tim+money+"</div><h2><a class='question_link' onclick='hrefgo(this)' data-money='"+d.Data[i].Pulu_Question.score+"' data-page='"+ulid+"' data-href='shareexppage.html?eid="+d.Data[i].Pulu_Question.id+"'>"+d.Data[i].Pulu_Question.title+"</a></h2><div class='ActionBar Question'> <div class='action_bar_inner'><div class='action_item'> <a class='ReadMoreActionItem'>浏览 "+count+"</a> </div> <div class='action_item'> <a class='ReadMoreActionItem'></a> </div></div></div></div></div></div>")
                }else{
                    if(d.Data[i].Pulu_Question.qtype===2||(!d.Data[i].Pulu_Question.qtype)){//问题 或无类型
                        if(ulid==="#quelist"){
                            if(d.Data[i].Pulu_Question.isShared===0){
                                $(ulid+" .addlistplace").append("<div class='pagedlist_item'><div class='feed_item feed_type_question'><div class='EventHeader'><span class='senduser'>"+unick+"</span>·"+tim+money+"</div><h2><a class='question_link' onclick='hrefgo(this)' data-page='"+ulid+"' data-href='questiondetail.html?qid="+d.Data[i].Pulu_Question.id+"'>"+d.Data[i].Pulu_Question.title+"</a></h2><div class='ContentFooter QuestionFooter'>浏览 "+count+"&nbsp;&nbsp;&nbsp;"+caller+"</div><div class='ActionBar Question'> <div class='action_bar_inner'><div class='primary_item'> <a class='WriteAnswer Button' onclick='hrefgo(this)' data-page='"+ulid+"' data-href='answerpage.html?qid="+d.Data[i].Pulu_Question.id+"'>回答 </a> </div> </div></div></div></div>")
                            }else if(d.Data[i].Pulu_Question.isShared===1){
                                var des="";
                                if(d.Data[i].Pulu_Question.des){
                                    des=d.Data[i].Pulu_Question.des;
                                }
                                var sharetim="";
                                console.log(d.Data[i].atmeTime);
                                if(d.Data[i].Pulu_Question.shareTime){
                                    //d.Data[i].atmeTime=d.Data[i].atmeTime.match(/[0-9\-T\:]+/)[0];
                                    sharetim=getDateDiff(getDateTimeStamp(d.Data[i].Pulu_Question.shareTime));
                                }
                                $("#quelist .addlistplace").append("<div class='pagedlist_item'><div class='feed_item feed_type_question'><div class='EventHeader'><span class='senduser'>"+ d.Data[i].shareUser.nick+"</span>·"+sharetim+"</div><div class='info_wrapper' style='margin-left:10px;margin-top:7px;'> <div class='info'> <span class='feed_item_answer_user'>"+des+"</span> </div> </div> <div class='borderbox'><div class='EventHeader'><span class='senduser'>"+unick+"</span>·"+tim+money+"</div><h2><a class='question_link' onclick='hrefgo(this)' data-page='"+ulid+"' data-href='questiondetail.html?qid="+d.Data[i].Pulu_Question.id+"'>"+d.Data[i].Pulu_Question.title+"</a></h2><div class='ActionBar Question'> <div class='action_bar_inner'><div class='action_item'> <a class='ReadMoreActionItem'>浏览 "+count+"</a> </div> <div class='action_item'> <a class='ReadMoreActionItem'></a> </div></div></div></div></div></div>")
                            }
                        }else{
                            //<div class='primary_item'> <span class='CantAnswerLink action_button'>跳过</span> </div>
                            $(ulid+" .addlistplace").append("<div class='pagedlist_item'><div class='feed_item feed_type_question'><div class='EventHeader'><span class='senduser'>"+unick+"</span>·"+tim+money+"</div><h2><a class='question_link' onclick='hrefgo(this)' data-page='"+ulid+"' data-href='questiondetail.html?qid="+d.Data[i].Pulu_Question.id+"'>"+d.Data[i].Pulu_Question.title+"</a></h2><div class='ContentFooter QuestionFooter'>浏览 "+count+"&nbsp;&nbsp;&nbsp;"+caller+"</div><div class='ActionBar Question'> <div class='action_bar_inner'><div class='primary_item'> <a class='WriteAnswer Button' onclick='hrefgo(this)' data-page='"+ulid+"' data-href='answerpage.html?qid="+d.Data[i].Pulu_Question.id+"'>回答 </a> </div> </div></div></div></div>")
                        }
                    }
                    else if(d.Data[i].Pulu_Question.qtype===3){
                        //判断是否有点赞者
                        var userimg="";//保存头像代码段
                        if(d.Data[i].userList.length>0&&d.Data[i].userList.length<10){
                            for(var r1=0;r1<d.Data[i].userList.length;r1++){
                                if(d.Data[i].userList[r1]){
                                    //console.log(d.Data[i].userList[r1].nick);
                                    if(d.Data[i].userList[r1].userAva){
                                        userimg+="<div><img src='http://42.62.66.198:8003/"+d.Data[i].userList[r1].userAva+"'/></div>";
                                    }
                                }
                            }
                        }else if(d.Data[i].userList.length>0&&d.Data[i].userList.length>10){
                            for(var r2=0;r2<10;r2++){
                                if(d.Data[i].userList[r2]){
                                    console.log(d.Data[i].userList[r2].nick);
                                    if(d.Data[i].userList[r2].userAva){
                                        userimg+="<div><img src='http://42.62.66.198:8003/"+d.Data[i].userList[r2].userAva+"'/></div>";
                                    }
                                }
                            }
                        }
                        //<div class='primary_item'> <span class='CantAnswerLink action_button'>跳过</span> </div>
                        $(ulid+" .addlistplace").append("<div class='pagedlist_item shareexperience'><div class='feed_item feed_type_question'><div class='EventHeader'><span class='senduser'>"+unick+"</span>·"+tim+money+"</div><h2><a class='question_link' data-money='"+d.Data[i].Pulu_Question.score+"' onclick='hrefgo(this)' data-page='"+ulid+"' data-euser='"+d.Data[i].Pulu_Question.questionUserId+"' data-href='shareexppage.html?eid="+d.Data[i].Pulu_Question.id+"'>"+d.Data[i].Pulu_Question.title+"</a></h2><div class='upviter'>"+userimg+"</div><div class='ActionBar Question'> <div class='action_bar_inner'><div class='action_item'> <a class='ReadMoreActionItem'>浏览 "+count+"</a> </div> <div class='action_item'> <a class='ReadMoreActionItem'>有用 "+d.Data[i].UpCount+caller+"</a> </div></div></div></div></div>")
                    }
                }

            };
            //页面滚动判断
            if(ulid===$.cookie("pulupagepage")&&fortime===r){
                $(window).scrollTop(parseFloat($.cookie("pulupagescroll")));
                $.cookie("pulupagepage","");//清除页面ID
                $.cookie("pulupagescroll","");//当前滚动距离
                $.cookie("pulupagepage","");//当前显示页面
                $.cookie("tjcurrentIndex","");//推荐数据页码
                $.cookie("zhncurrentIndex","");//召唤你数据页码
                $.cookie("jycurrentIndex","");//经验 铺路数据页码
                $.cookie("quecurrentIndex","");//问题 铺路数据页码
            }
            if(fortime===r){
                readyover=0;
            }
        };
        num=0;
        console.log("通用方法里的readyover："+readyover);
    }
};
											//经验数据
											function jy(jycurrentIndex,pageSize){
												if(jyover===0){
													//console.log("经验");
													$.ajax({
														type:"get",
														datatype:"json",
														url:expurl+id+"&qtype=3&currentIndex="+jycurrentIndex+"&pageSize="+pageSize,
														success:function(d){
															console.log("经验数据");
															console.log(d);
															var ulid="#explist";
															if(d.Message==="没有数据"||(d.Data&&d.Data.length===0)){
																jyover=1;
																readyover=0;
																console.log("jyover没有数据了readyover："+readyover);
																$("#waiting1").remove();
																$("#nonews1").css("display","block");
															}else{
																if(d.Data.length<pageSize){
																	$("#waiting1").remove();
																	$("#nonews1").css("display","block");
																}
																var fortime=0;//循环次数
																for(var i= 0,r=d.Data.length;i<r ;i++){
																	fortime++;
																	d.Data[i].index=i;
																	if(d.Data[i].Pulu_Question.title.length>0){
																		var jname="";
																		var reg=/[\u4E00-\u9FA5]*/;
																		if(d.Data[i].Pulu_Question.jobtypenames){
																			var jlist=d.Data[i].Pulu_Question.jobtypenames;
																			jname=" · "+jlist.match(reg)[0];
																		}else if(d.Data[i].Pulu_Question.hobbytypenames){
																			var hlist=d.Data[i].Pulu_Question.hobbytypenames;
																			jname=" · "+hlist.match(reg)[0];
																		}
																		var unick="";
																		if(d.Data[i].user){
																			if(d.Data[i].user.nick){
																				if(d.Data[i].Pulu_Question.ishidename==1&&d.Data[i].user.userId!=id){
																					unick="<a>匿名</a>";
																				}else{
																					unick="<a href='otherpeoplepage.html?otherid="+d.Data[i].user.userId+"'>"+d.Data[i].user.nick+"</a>";
																				}
																			}
																		}
																		var otherid=d.Data[i].user.userId;
																		    var tim="";
                            if(d.Data[i].Pulu_Question.ctime){
                                tim=getDateDiff(getDateTimeStamp(d.Data[i].Pulu_Question.ctime));
                            }
																		var money="";//有没有钱
																			if(d.Data[i].Pulu_Question.score>0){
																				money="<span class='havemy'><img src='img/money04.png'>"+d.Data[i].Pulu_Question.score+"</span>";
																			}
																		if((d.Data[i].Pulu_Question.qtype===2||(!d.Data[i].Pulu_Question.qtype))){//问题 或无类型
																			//<div class='primary_item'> <span class='CantAnswerLink action_button'>跳过</span> </div>
																			if(d.Data[i].Pulu_Question.isShared===0){
																				var ulid="#explist";
																				var count=0;
																				if(d.Data[i].Pulu_Question.count){
																					count=d.Data[i].Pulu_Question.count;
																				}
																				$("#explist .addlistplace").append("<div class='pagedlist_item'><div class='feed_item feed_type_question'><div class='EventHeader'><span class='senduser'>"+unick+"</span><span class='job'>"+jname+"</span>·"+tim+money+"</div><h2><a class='question_link' onclick='hrefgo(this)' data-qid='"+d.Data[i].Pulu_Question.id+"' data-page='"+ulid+"' data-href='questiondetail.html?qid="+d.Data[i].Pulu_Question.id+"'>"+d.Data[i].Pulu_Question.title+"</a></h2><div class='ContentFooter QuestionFooter'>浏览 "+count+"&nbsp;&nbsp;&nbsp;"+"</div><div class='ActionBar Question'> <div class='action_bar_inner'><div class='primary_item'> <a class='WriteAnswer Button' onclick='hrefgo(this)' data-page='#explist' data-href='answerpage.html?qid="+d.Data[i].Pulu_Question.id+"'>回答 </a> </div> </div></div></div></div>")
																			}else if(d.Data[i].Pulu_Question.isShared===1){
																				var ulid="#explist";
																				var des="";
																				if(d.Data[i].Pulu_Question.des){
																					des=d.Data[i].Pulu_Question.des;
																				}
																				var sharetim="";
																			if(d.Data[i].Pulu_Question.shareTime){
																				sharetim=getDateDiff(getDateTimeStamp(d.Data[i].Pulu_Question.shareTime.match(/[0-9\-T\:]+/)[0]));
																				console.log(tim);
																			}
																				var count=0;
																				if(d.Data[i].Pulu_Question.count){
																					count=d.Data[i].Pulu_Question.count;
																				}
																				$("#explist .addlistplace").append("<div class='pagedlist_item'><div class='feed_item feed_type_question'><div class='EventHeader'><span class='senduser'>"+unick+"</span><span class='job'>"+jname+"</span>·"+tim+money+"</div><div class='AnswerHeader ContentHeader'> <div class='photo_info_layout size_small'> <div class='photo_wrapper'> <div class='photo'> <a onclick='hrefgo(this)' data-page='"+ulid+"'  data-href='otherpeoplepage.html?otherid="+otherid+"'><img class='profile_photo_img' src='http://42.62.66.198:8003/"+d.Data[i].user.userAva+"'> </a> </div> </div> <div class='info_wrapper'> <div class='info'> <span class='feed_item_answer_user'>"+des+"</span> </div> </div> </div> </div><h2><a class='question_link' onclick='hrefgo(this)' data-qid='"+d.Data[i].Pulu_Question.id+"' data-page='"+ulid+"' data-href='questiondetail.html?qid="+d.Data[i].Pulu_Question.id+"'>"+d.Data[i].Pulu_Question.title+"</a></h2><div class='ContentFooter QuestionFooter'>浏览 "+count+"&nbsp;&nbsp;&nbsp;"+"</div><div class='ActionBar Question'> <div class='action_bar_inner'><div class='primary_item'> <a class='WriteAnswer Button' onclick='hrefgo(this)' data-page='#explist' data-href='answerpage.html?qid="+d.Data[i].Pulu_Question.id+"'>回答 </a> </div> </div></div></div></div>")
																			}

																		}
																		 else if(d.Data[i].Pulu_Question.qtype===3){
                                //判断是否有点赞者
                                var userimg="";//保存头像代码段
                                if(d.Data[i].userList.length>0&&d.Data[i].userList.length<10){
                                    for(var r1=0;r1<d.Data[i].userList.length;r1++){
                                        if(d.Data[i].userList[r1]){
                                            //console.log(d.Data[i].userList[r1].nick);
                                            if(d.Data[i].userList[r1].userAva){
                                                userimg+="<div><img src='http://42.62.66.198:8003/"+d.Data[i].userList[r1].userAva+"'/></div>";
                                            }
                                        }
                                    }
                                }else if(d.Data[i].userList.length>0&&d.Data[i].userList.length>10){
                                    for(var r2=0;r2<10;r2++){
                                        if(d.Data[i].userList[r2]){
                                            //console.log(d.Data[i].userList[r2].nick);
                                            if(d.Data[i].userList[r2].userAva){
                                                userimg+="<div><img src='http://42.62.66.198:8003/"+d.Data[i].userList[r2].userAva+"'/></div>";
                                            }
                                        }
                                    }
                                }
                                if(d.Data[i].Pulu_Question.isShared===0){
                                    var count=0;
                                    if(d.Data[i].Pulu_Question.count){
                                        count=d.Data[i].Pulu_Question.count;
                                    }
                                    //<div class='primary_item'> <span class='CantAnswerLink action_button'>跳过</span> </div>
                                    $("#explist .addlistplace").append("<div class='pagedlist_item shareexperience'><div class='feed_item feed_type_question'><div class='EventHeader'><span class='senduser'>"+unick+"</span>·"+tim+money+"</div><h2><a class='question_link' data-money='"+d.Data[i].Pulu_Question.score+"' onclick='hrefgo(this)' data-page='"+ulid+"' data-euser='"+d.Data[i].Pulu_Question.questionUserId+"' data-href='shareexppage.html?eid="+d.Data[i].Pulu_Question.id+"'>"+d.Data[i].Pulu_Question.title+"</a></h2><div class='upviter'>"+userimg+"</div><div class='ActionBar Question'> <div class='action_bar_inner'><div class='action_item'> <a class='ReadMoreActionItem'>浏览 "+count+"</a> </div> <div class='action_item'> <a class='ReadMoreActionItem'>有用 "+d.Data[i].UpCount+"</a> </div></div></div></div></div>")
                                }else if(d.Data[i].Pulu_Question.isShared===1){
                                    var des="";
                                    if(d.Data[i].Pulu_Question.des){
                                        des=d.Data[i].Pulu_Question.des;
                                    }
                                    var count=0;
                                    if(d.Data[i].Pulu_Question.count){
                                        count=d.Data[i].Pulu_Question.count;
                                    }
                                    var sharetim=getDateDiff(d.Data[i].Pulu_Question.shareTime);
                                    //<div class='AnswerHeader ContentHeader'> <div class='photo_info_layout size_small'> <div class='photo_wrapper'> <div class='photo'> <a onclick='hrefgo(this)' data-page='"+ulid+"' data-href='otherpeoplepage.html?otherid="+otherid+"'> <img class='profile_photo_img' src='http://42.62.66.198:8003/"+d.Data[i].user.userAva+"'> </a> </div> </div> </div> </div>
                                    $("#explist .addlistplace").append("<div class='pagedlist_item shareexperience'><div class='feed_item feed_type_question'><div class='EventHeader'><span class='senduser'>"+ d.Data[i].shareUser.nick+"</span>·"+sharetim+"</div><div class='info_wrapper' style='margin-left:10px;margin-top:7px;'> <div class='info'> <span class='feed_item_answer_user'>"+des+"</span> </div> </div> <div class='borderbox'><div class='EventHeader'><span class='senduser'>"+unick+"</span>·"+tim+money+"</div><h2><a class='question_link' onclick='hrefgo(this)' data-euser='"+d.Data[i].Pulu_Question.questionUserId+"' data-money='"+d.Data[i].Pulu_Question.score+"' data-page='"+ulid+"' data-href='shareexppage.html?eid="+d.Data[i].Pulu_Question.id+"'>"+d.Data[i].Pulu_Question.title+"</a></h2><div class='upviter'>"+userimg+"</div><div class='ActionBar Question'> <div class='action_bar_inner'><div class='action_item'> <a class='ReadMoreActionItem'>浏览 "+count+"</a> </div> <div class='action_item'> <a class='ReadMoreActionItem'>有用 "+d.Data[i].UpCount+"</a> </div></div></div></div></div></div>")
                                }
                            }
                        };
																	//页面滚动判断
																	if("#explist"===$.cookie("pulupagepage")&&fortime===r&&$.cookie("pulupagescroll")&&parseFloat($.cookie("pulupagescroll"))>0){
																		$(window).scrollTop(parseFloat($.cookie("pulupagescroll")));
																		readyover=0;
																		$.cookie("pulupagepage","");//清除页面ID
																		$.cookie("pulupagescroll","");//当前滚动距离
																		$.cookie("pulupagepage","");//当前显示页面
																		$.cookie("tjcurrentIndex","");//推荐数据页码
																		$.cookie("zhncurrentIndex","");//召唤你数据页码
																		$.cookie("jycurrentIndex","");//经验 铺路数据页码
																	};
																	if(fortime==r){
																		readyover=0;
																	}
																};
															}
														}
													})
												};
											}
											
//=================================================================================================================================================================
//-----------------------------------------------------------------------------------------------------------------------------------------------------------------
//=================================================================================================================================================================
                                }
                                //如果有用户ID 就把cookies里的用户id替换成获取到的id  在这里控制跳转提示框
                            }
                        })
                    }
                })
            }else{
			
                location.href="https://open.weixin.qq.com/connect/oauth2/authorize?appid=wx658c34793ecfd9f9&redirect_uri="+returnurl+"&response_type=code&scope=snsapi_userinfo&state=STATE#wechat_redirect";
            }
			}
        })

